import {getStorage} from '@/utils/storeutil'
import {TOKEKEY} from '@/utils/constant'
import {useLocation,Navigate} from 'react-router-dom'
export default function Auth(props:any) {
  const token=getStorage(TOKEKEY)
  const location=useLocation()
  const whiteList=['/login']
  if(token){
    return <>{props.children}</>
  }else{
    if(whiteList.includes(location.pathname)){
        return <>{props.children}</>
    }else{
        return <Navigate to="/login"></Navigate>
    }
  }
  return (
    <div>Auth</div>
  )
}
